/* AI助手页面样式 */

.ai-container {
    height: calc(100vh - 160px);
    display: flex;
    flex-direction: column;
    max-width: 1200px;
    margin: 0 auto;
    background-color: #f9f9f9;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 15px 20px;
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-title {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    display: flex;
    align-items: center;
}

.chat-title i {
    margin-right: 8px;
    color: var(--primary-color);
}

.chat-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

/* 功能控制区样式优化 */
.feature-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 20px;
    background-color: #f1f1f1;
    border-bottom: 1px solid #e0e0e0;
}

.feature-toggle {
    display: flex;
    align-items: center;
    background-color: #fff;
    padding: 6px 12px;
    border-radius: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.feature-toggle label {
    margin-left: 5px;
    font-size: 14px;
    cursor: pointer;
    user-select: none;
}

/* 自定义开关样式 */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 20px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .toggle-slider {
    background-color: var(--primary-color);
}

input:checked + .toggle-slider:before {
    transform: translateX(16px);
}

.clear-history {
    background-color: #ff4d4f;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
}

.clear-history i {
    font-size: 12px;
    margin-right: 4px;
}

.clear-history:hover {
    background-color: #ff7875;
}

.context-info {
    font-size: 12px;
    color: #666;
    margin-left: auto;
    display: flex;
    align-items: center;
    padding: 6px 12px;
    background-color: #fff;
    border-radius: 20px;
}

/* 消息区域优化 */
.messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background-color: #f9f9f9;
}

.message {
    margin-bottom: 20px;
    max-width: 85%;
    animation: fadeIn 0.3s ease;
    position: relative;
    display: flex;
    flex-direction: column;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.user-message {
    margin-left: auto;
    background-color: #e3f2fd;
    border-radius: 18px 18px 4px 18px;
    align-items: flex-end;
}

.user-message .message-sender {
    color: #1a73e8;
    align-self: flex-end;
}

.user-message .message-content {
    background-color: transparent;
}

.ai-message {
    margin-right: auto;
    background-color: #ffffff;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    align-items: flex-start;
}

.ai-message .message-sender {
    color: #ea4335;
    align-self: flex-start;
}

.ai-message .message-content {
    background-color: transparent;
}

.message-sender {
    font-weight: 600;
    font-size: 14px;
    padding: 10px 15px 5px;
    display: block;
    color: #444;
}

.message-content {
    padding: 0 15px 10px;
    word-break: break-word;
    line-height: 1.5;
}

.message-time {
    display: block;
    font-size: 10px;
    color: #888;
    text-align: right;
    padding: 0 15px 5px;
}

/* 消息来源标签 */
.message-model {
    font-size: 12px;
    color: #888;
    margin-left: 8px;
    font-weight: normal;
}

/* 网络搜索标签 */
.web-search-tag {
    display: inline-block;
    font-size: 11px;
    background-color: #4caf50;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

/* 输入区域优化 */
.input-area {
    background-color: #fff;
    padding: 15px;
    border-top: 1px solid #e0e0e0;
}

.input-actions {
    display: flex;
    margin-bottom: 10px;
}

.upload-image {
    display: flex;
    align-items: center;
    background-color: #f1f1f1;
    border: none;
    padding: 8px 12px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.upload-image svg {
    width: 18px;
    height: 18px;
    margin-right: 5px;
}

.upload-image:hover {
    background-color: #e0e0e0;
}

.file-input {
    display: none;
}

.preview-container {
    display: none;
    margin-bottom: 10px;
    position: relative;
    max-width: 200px;
}

.preview-image {
    width: 100%;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background-color: #f44336;
    color: white;
    border: none;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.input-container {
    display: flex;
    background-color: #f1f1f1;
    border-radius: 24px;
    padding: 4px;
}

.message-input {
    flex: 1;
    border: none;
    outline: none;
    padding: 12px 16px;
    border-radius: 20px;
    resize: none;
    max-height: 120px;
    background-color: #f1f1f1;
    font-family: inherit;
    font-size: 15px;
}

.send-button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.send-button:hover {
    background-color: var(--primary-color-dark);
}

/* 正在输入指示器样式 */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: #aaa;
    border-radius: 50%;
    animation: typingAnimation 1.5s infinite ease-in-out;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

/* 用户上传的图片样式 */
.user-uploaded-image {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin-top: 8px;
    cursor: pointer;
    transition: transform 0.2s;
}

.user-uploaded-image:hover {
    transform: scale(1.05);
}

/* 图片查看器样式 */
.image-viewer {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.image-viewer-content {
    max-width: 90%;
    max-height: 90%;
    position: relative;
}

.image-viewer-img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: 4px;
}

.image-viewer-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 30px;
    cursor: pointer;
    z-index: 1001;
}

/* Markdown内容样式 */
.markdown-content {
    line-height: 1.5;
}

.markdown-content h1, 
.markdown-content h2, 
.markdown-content h3, 
.markdown-content h4, 
.markdown-content h5, 
.markdown-content h6 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    font-weight: 600;
}

.markdown-content h1 {
    font-size: 1.8em;
}

.markdown-content h2 {
    font-size: 1.5em;
}

.markdown-content h3 {
    font-size: 1.3em;
}

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content a {
    color: #1a73e8;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content ul, 
.markdown-content ol {
    margin: 1em 0;
    padding-left: 2em;
}

.markdown-content li {
    margin-bottom: 0.5em;
}

.markdown-content blockquote {
    padding: 0.5em 1em;
    margin: 1em 0;
    border-left: 3px solid #dadce0;
    background-color: #f8f9fa;
}

.markdown-content pre {
    padding: 1em;
    overflow-x: auto;
    background-color: #f8f9fa;
    border-radius: 4px;
    margin: 1em 0;
}

.markdown-content code {
    padding: 0.2em 0.4em;
    background-color: #f8f9fa;
    border-radius: 3px;
    font-family: monospace;
}

.markdown-content pre code {
    padding: 0;
    background-color: transparent;
    border-radius: 0;
    font-size: 0.9em;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 1em 0;
}

.markdown-content table th,
.markdown-content table td {
    padding: 0.5em;
    border: 1px solid #dadce0;
}

.markdown-content table tr {
    background-color: #fff;
    border-top: 1px solid #dadce0;
}

.markdown-content table tr:nth-child(2n) {
    background-color: #f8f9fa;
}

.markdown-content img {
    max-width: 200px;
    max-height: 200px;
    border-radius: 8px;
    margin: 8px 0;
    cursor: pointer;
    transition: transform 0.2s;
}

.markdown-content img:hover {
    transform: scale(1.05);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .ai-container {
        height: calc(100vh - 100px);
        border-radius: 0;
    }
    
    .message {
        max-width: 90%;
    }
    
    .feature-controls {
        padding: 8px 12px;
        gap: 6px;
    }
    
    .feature-toggle {
        padding: 4px 8px;
        font-size: 12px;
    }
} 